using Mysoft.Dbf.Writers;

namespace Mysoft.Dbf
{
    public class ExportAsCharacterColumnArrayAttribute : ExportToDBFAttributeBase
    {
        byte _fieldSize;
        byte _arrayLength;
        string _namingVariableName;
        string _columnNameFormat;

        public ExportAsCharacterColumnArrayAttribute(string columnNameFormat, string variableName, byte arrayLength, byte fieldSize)
        {
            _columnNameFormat = columnNameFormat;
            _arrayLength = arrayLength;
            _fieldSize = fieldSize;
            _namingVariableName = variableName;
        }
        public override IWriter GetWriter()
        {
            return new ArrayWriter(this._namingVariableName, 1, this._arrayLength,
                 new CharacterFieldWriter(this._columnNameFormat, this._fieldSize, true));
        }
    }
}
